<?php

namespace app\api\controller\haibao;

use app\admin\model\HaibaoAcc;
use app\admin\model\HaibaoCommodity;
use app\api\controller\Base;
use think\Request;

/**
 * @author zero
 * @Time 2018/12/28
 *
 * Class Commodity
 * @package app\api\controller\haibao
 *
 * 嗨爆小片积分商品
 */
class Commodity extends Base
{
    // openid
    public $openid;

    public function __construct(Request $request = null)
    {
        parent::__construct($request);
        $this->openid = $request->param('openid');
    }

    // 获取用户积分和积分商品列表
    public function get_commodity_info()
    {
        $list = HaibaoCommodity::all();
        $credit = HaibaoAcc::where('openid', $this->openid)->value('credit');
        $data['credit'] = $credit;
        $data['list'] = $list;
        $this->result('commodity', $data);
    }

}
